home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWCollec / Sources / FWOrdCol.cpp next >
Encoding:
Text File  |  1996-04-25  |  3.3 KB  |  99 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWOrdCol.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWFound.hpp"
  11.  
  12. #ifndef FWORDCOL_H
  13. #include "FWOrdCol.h"
  14. #endif
  15.  
  16. //======================================================================================
  17. // Runtime Informations
  18. //======================================================================================
  19.  
  20. #ifdef FW_BUILD_MAC
  21. #pragma segment fwcollec
  22. #endif
  23.  
  24. //======================================================================================
  25. // Default Matching Proc
  26. //======================================================================================
  27.  
  28. static FW_Boolean FW_PrivOrderedCollection_DefaultMatchProc(const void* v1, const void* v2)
  29. {
  30.     return (v1 == v2);
  31. }
  32.  
  33. //======================================================================================
  34. // Class FW_CPrivOrderedCollection
  35. //======================================================================================
  36.  
  37. FW_DEFINE_AUTO(FW_CPrivOrderedCollection)
  38.  
  39. //--------------------------------------------------------------------------------------
  40. // FW_CPrivOrderedCollection::FW_CPrivOrderedCollection
  41. //--------------------------------------------------------------------------------------
  42.  
  43. FW_CPrivOrderedCollection::FW_CPrivOrderedCollection(FW_OrderedCollection_MatchProc matchProc) :
  44.     fImplementation(NULL),
  45.     fMatchProc(matchProc ? matchProc : &FW_PrivOrderedCollection_DefaultMatchProc)
  46. {
  47.     FW_PlatformError error;
  48.     fImplementation = FW_PrivNewLinkedList(&error);
  49.     FW_FailOnError(error);
  50.     
  51.     FW_END_CONSTRUCTOR
  52. }
  53.  
  54. //--------------------------------------------------------------------------------------
  55. // FW_CPrivOrderedCollection::~FW_CPrivOrderedCollection
  56. //--------------------------------------------------------------------------------------
  57.  
  58. FW_CPrivOrderedCollection::~FW_CPrivOrderedCollection()
  59. {
  60.     FW_START_DESTRUCTOR
  61.     FW_PrivDeleteLinkedList(fImplementation);
  62. }
  63.  
  64. //======================================================================================
  65. // FW_CPrivOrderedCollectionIterator
  66. //======================================================================================
  67.  
  68. FW_DEFINE_AUTO(FW_CPrivOrderedCollectionIterator)
  69.  
  70. //--------------------------------------------------------------------------------------
  71. // FW_CPrivOrderedCollectionIterator::FW_CPrivOrderedCollectionIterator
  72. //--------------------------------------------------------------------------------------
  73.  
  74. FW_CPrivOrderedCollectionIterator::FW_CPrivOrderedCollectionIterator(const FW_CPrivOrderedCollection* collection)    
  75.     : fImplementation(NULL)
  76. {
  77.     FW_PlatformError error;
  78.     fImplementation = FW_PrivNewLinkedListIterator(collection ? collection->fImplementation : NULL, &error);
  79.     FW_FailOnError(error);
  80.     
  81.     FW_END_CONSTRUCTOR
  82. }
  83.  
  84. //--------------------------------------------------------------------------------------
  85. // FW_CPrivOrderedCollectionIterator::~FW_CPrivOrderedCollectionIterator
  86. //--------------------------------------------------------------------------------------
  87.  
  88. FW_CPrivOrderedCollectionIterator::~FW_CPrivOrderedCollectionIterator()                        
  89. {
  90.     FW_START_DESTRUCTOR
  91.     FW_PrivDeleteLinkedListIterator(fImplementation);
  92. }
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.